From e23f7c13b0fd951b89cf545b450ed50889b241dc Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 15 Aug 2014 14:10:55 -0400 Subject: [PATCH] GtkFontButton: Use the same font name as the font chooser The font chooser constructs the display name for the font from the family and face names. Do the same in the font button, so we don't end up calling the same font by different names, which would be confusing. --- gtk/gtkfontbutton.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c index 734e878e05..22cca740ca 100644 --- a/gtk/gtkfontbutton.c +++ b/gtk/gtkfontbutton.c @@ -1142,20 +1142,17 @@ static void gtk_font_button_update_font_info (GtkFontButton *font_button) { GtkFontButtonPrivate *priv = font_button->priv; + const gchar *fam_name; + const gchar *face_name; gchar *family_style; - g_assert (priv->font_desc != NULL); + fam_name = pango_font_family_get_name (priv->font_family); + face_name = pango_font_face_get_face_name (priv->font_face); if (priv->show_style) - { - PangoFontDescription *desc = pango_font_description_copy_static (priv->font_desc); - - pango_font_description_unset_fields (desc, PANGO_FONT_MASK_SIZE); - family_style = pango_font_description_to_string (desc); - pango_font_description_free (desc); - } + family_style = g_strconcat (fam_name, " ", face_name, NULL); else - family_style = g_strdup (pango_font_description_get_family (priv->font_desc)); + family_style = g_strdup (fam_name); gtk_label_set_text (GTK_LABEL (font_button->priv->font_label), family_style); g_free (family_style); -- 2.30.2